package com.lxgzhw.student_manager02.dao;

import com.lxgzhw.student_manager02.domain.Student;
import com.lxgzhw.student_manager02.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserDao extends JpaRepository<User, Integer> {
    @Query(value = "select id,username,password from user where username=?1 and password=?2", nativeQuery = true)
    User findByUsernameAndPassword(String username, String password);

    @Query(value = "select * from user limit ?1,?2", nativeQuery = true)
    List<User> findLimit(Integer page, Integer limit);
}
